package com.my.page;

import java.util.ArrayList;
import java.util.List;

import lombok.Data;

@Data
public class Menu {

	private String id;
	private String name;
	private String url;
	private List<Menu> children;
	
	public  Menu add(String name,String url) {
		if(this.children==null) {
			children=new ArrayList();
		}
		if(this.id==null) {
			this.id="0";
		}
		Menu menu=new Menu();
		menu.setId(this.id+"_"+children.size());
		menu.setName(name);
		menu.setUrl(url);
		
		children.add(menu);
		return menu;
	}
	
	
}
